package org.study.poi_excel.excel;

import java.io.Serializable;

import org.study.poi_excel.utils.Contants;
/**
 * @author ou_qu_sheng
 * Description:
 * 对注解Excel做参数的映射，行高这个参数比较特殊。暂定未使用
 *
 */
public class ExcelParam implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * excel的列标题
	 */
	private String name;
	/**
	 * 日期的格式
	 */
	private String dateFormat;
	/**
	 * 列的序号
	 */
	private int index;
	/**
	 * 列宽
	 */
	private double width;
	/**
	 * 行高
	 */
	private double hight;
	
	
	public ExcelParam() {
	}

	public ExcelParam(String name, int index) {
		this.name = name;
		this.index = index;
		this.width = Contants.width;
		this.hight = Contants.hight;
		this.dateFormat = Contants.DEFAULT_DATE_FORMAT;
	}
	
	public ExcelParam(String name, int index , int width) {
		this.name = name;
		this.index = index;
		this.width = width;
		this.hight = Contants.hight;
		this.dateFormat = Contants.DEFAULT_DATE_FORMAT;
	}
	
	public ExcelParam(String name, String dateFormat, int index, double width, double hight) {
		this.name = name;
		this.dateFormat = dateFormat;
		this.index = index;
		this.width = width;
		this.hight = hight;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDateFormat() {
		return dateFormat;
	}

	public void setDateFormat(String dateFormat) {
		this.dateFormat = dateFormat;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public double getWidth() {
		return width;
	}

	public void setWidth(double width) {
		this.width = width;
	}

	public double getHight() {
		return hight;
	}

	public void setHight(double hight) {
		this.hight = hight;
	}

	//动态的转为数组
	public static ExcelParam[] asArray(ExcelParam... pojos) {
		int len = null != pojos ? pojos.length : 0;
		ExcelParam[] array = new ExcelParam[len];
		for(int i=0; i < len; i++) {
			array[i] = pojos[i];
		}
		return array;
	}
	
}
